Skip to content

Conversation

phrwlk
Copy link
Contributor

@phrwlk phrwlk commented Oct 6, 2025

The dynamic test linking preprocessor failed to preserve the contract type for try-constructor statements. For code like try new C(...) returns (C c) { ... }, the transformation produced vm.deployCode(...) without wrapping, leaving the expression typed as address. This mismatched the expected type C and could fail compilation when a returns (C) clause was present.

This change unifies handling for both try and non-try constructor creations by always wrapping the transformed expression as C(payable(vm.deployCode({...}))), ensuring the resulting type remains the contract type. Added a CLI test that asserts try new C(...) returns (C c) compiles after preprocessing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant